import Vue from "vue";
import App from "./App";
import router from "./router";
import "./api.js";
import ElementUI from "element-ui";
// 导入组件
import "element-ui/lib/theme-chalk/index.css";
// 导入样式
import global from "./assets/css/global.css";
import TreeTable from "vue-table-with-tree-grid";
// 导入富文本编辑器
import VueQuillEditor from "vue-quill-editor";
// 导入富文本编辑器对应的样式
import "quill/dist/quill.core.css"; // import styles
import "quill/dist/quill.snow.css"; // for snow theme
import "quill/dist/quill.bubble.css"; // for bubble theme

// import elementui from './components/plugins/elementui'
// Vue.use(elementui)

// 注册为全局可用的富文本
Vue.use(VueQuillEditor);
Vue.component("tree-table", TreeTable);

// 定义一个过滤器 来展示时间 dateFormat是一个命名
Vue.filter("dateFormat", function(originVal) {
  const dt = new Date(originVal);

  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + "").padStart(2, "0"); //padStart是以两位的形式，不够的话后面补0  +1就是月数进一  dt.month+''就是转换成字符串
  const d = (dt.getDate() + "").padStart(2, "0");
  const hh = (dt.getHours() + "").padStart(2, "0");
  const mm = (dt.getMinutes() + "").padStart(2, "0");
  const ss = (dt.getSeconds() + "").padStart(2, "0");
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});

Vue.use(ElementUI);
Vue.use(global);

Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
  el: "#app",
  router,
  render: h => h(App)
});
